A model is presented to explain the physics of nerve stimulation by electromagnetic induction. Maxwell's equations predict the induced electric field distribution produced when a capacitor is discharged through a stimulating coil. A nonlinear cable model, containing active Hodgkin-Huxley elements, describes the response of the nerve fiber to this induced electric field. It is shown that the nerve fiber is stimulated by the gradient of the component of the induced electric field parallel to the fiber, which hyperpolarizes or depolarizes the membrane and may stimulate an action potential. Once the coil's position, orientation, and shape are given and the resistance, capacitance, and initial voltage of the stimulating coil are specified, this model predicts the resulting transmembrane potential of the fiber as a function of distance and time. Finally, it predicts complicated dynamics, such as action potential annihilation and dispersion. The model has been verified experimentally in humans. A new four-leaf coil design for magnetic stimulation of peripheral nerves has been developed and has been tested using in vitro experiments.